package com.taptech.doufu.ui.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;

public class ResizeLinearLayout extends LinearLayout {
	private OnLinearLayoutResizeListener listener;

	public ResizeLinearLayout(Context context) {
		super(context);
	}

	public ResizeLinearLayout(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	@Override
	protected void onSizeChanged(int w, int h, int oldw, int oldh) {
		super.onSizeChanged(w, h, oldw, oldh);
	
		if(listener!=null){
			boolean flag=false;
			if(h < oldh){
				flag=true;
			}else{
				flag=false;
			}
			listener.onResize(flag,oldh-h);
		}
	}

	public void setOnLinearLayoutResizeListener(OnLinearLayoutResizeListener listener) {
		this.listener = listener;
	}

	public interface OnLinearLayoutResizeListener {
		void onResize(boolean flag,int space);
	}
}